runtime.load("./autojs-websocket.jar");

importClass("org.autojs.websocket.SimpleWebSocketClient");

var client = new SimpleWebSocketClient("ws://echo.websocket.org");

client.setListener({
    onOpen: function(serverHandshake) {
        console.log(serverHandshake)
    },
    onMessage: function(message) {
        console.log(message)
    },
    onClose: function(code, reason, remote) {
        console.log(code, reason, remote)
    },
    onError: function(exception) {
        console.log(exception)
    }
});

client.connectBlocking(10);

client.send("hello server");